﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

/// <summary>
/// 新股每日提示
/// </summary>
public partial class morning_xgmrts : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }


    protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
        if (e.Day.IsOtherMonth)
        {
            return;
        }
        DateTime dt = e.Day.Date;
        var cell = e.Cell;
        HyperLink lnk = new HyperLink();
      
        lnk.NavigateUrl = "#";
        CMSModel.CMSEntities cms = new CMSModel.CMSEntities();
        Literal l = new Literal();
        l.Text = "<br/>";
        if (cms.IssueDate.Any(x => x.CTime == e.Day.Date))
        {
            lnk.Attributes.Add("IsEdit", "true");
            var id = cms.IssueDate.First(x => x.CTime == e.Day.Date).Id;
            lnk.Text = "修改";
            lnk.Attributes.Add("tid", id.ToString());
            HyperLink lnkDel = new HyperLink();
            lnkDel.Text = "删除";
            lnkDel.NavigateUrl = "#";
            lnkDel.Attributes.Add("tid", id.ToString());
            lnkDel.Attributes.Add("IsDelete", "true");
            cell.Controls.Add(l);
            cell.Controls.Add(lnk);
            cell.Controls.Add(lnkDel);
        }
        else
        {
            lnk.Attributes.Add("ctime", e.Day.Date.ToString());
            lnk.Attributes.Add("IsAdd", "true");
            lnk.Text = "添加";
            cell.Controls.Add(l);
            cell.Controls.Add(lnk);

        }
    }
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        string str=txtQuery.Text;
        CMSModel.CMSEntities cms = new CMSModel.CMSEntities();
        var lst= cms.IssueDate.Where(x => x.sgjy.Contains(str) || x.czjy.Contains(str));
        Repeater1.DataSource = lst;
        Repeater1.DataBind();
    }
}